package com.didi.gulimall.ware.dao;

import com.didi.gulimall.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品库存
 * 
 * @author didi
 * @email 1062664904@qq.com
 * @date 2021-01-14 16:10:36
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    List<Long> listWareIdHasSkuStock(@Param("skuId") Long skuId, @Param("count") Integer count);

    Long lockSkuStock(@Param("num") Integer num, @Param("skuId") Long skuId, @Param("wareId") Long wareId);

    void unLookStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("num") Integer num);

    void deductionInventory(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuNum") Integer skuNum);

    void releaseInventory(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("num") Integer num);
}
